package com.blockmeta.bbs.businesslibrary.widget.scale;

import android.app.Activity;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.blockmeta.bbs.businesslibrary.R;
import com.blockmeta.bbs.businesslibrary.pojo.TeacherListPOJO;
import com.blockmeta.bbs.businesslibrary.widget.CircleImageView;
import com.squareup.picasso.Picasso;

/**
 * @author AirThor
 * @date 2018/12/4.
 */
public class TeacherPopupWindow extends BaseScalePopupWindow {
    public CircleImageView mAvatar;
    public TextView mName,mLocation,mIntroduce,mDomain,mDomainTag;
    private Activity mContext;
    public TeacherPopupWindow(Activity context) {
        super(context);
        mContext = context;
    }
    @Override
    public int getResId() {
        return R.layout.popup_teacher_view;
    }

    @Override
    protected void bindEvent() {
        if (popupView!=null){
            mAvatar = popupView.findViewById(R.id.iv_avatar);
            mName = popupView.findViewById(R.id.tv_name);
            mLocation = popupView.findViewById(R.id.tv_location);
            mIntroduce = popupView.findViewById(R.id.tv_introduce);
            mDomain = popupView.findViewById(R.id.tv_domain);
            mDomainTag = popupView.findViewById(R.id.tv_tag_domain);
        }
    }

    @Override
    public View getClickToDismissView() {
        return popupView.findViewById(R.id.click_to_dismiss);
    }

    @Override
    public View initAnimaView() {
        return popupView.findViewById(R.id.popup_anima);
    }

    public void setData(TeacherListPOJO data){
        Picasso.with(mContext).load(data.teacherImg).into(mAvatar);
        mName.setText(data.teacherName);
        mLocation.setText(data.teacherTitle);
        mIntroduce.setText(data.teacherDesc);
        mDomain.setVisibility(TextUtils.isEmpty(data.teacherTag)?View.GONE:View.VISIBLE);
        mDomainTag.setVisibility(TextUtils.isEmpty(data.teacherTag)?View.GONE:View.VISIBLE);
        mDomain.setText(data.teacherTag);
    }
}
